	.fopt		compiler,"cc65 v 2.13.9"
	.setcpu		"6502"
	.smart		on
	.autoimport	on
	.case		on
	.debuginfo	off
	.importzp	sp, sreg, regsave, regbank
	.importzp	tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
	.macpack	longbranch
	.export		_copyFile


.segment "COPYFILE"
.proc _copyFile
	jsr     pusha
	ldy     #$02
	ldx     #$00
	lda     (sp),y

	jsr $df86
	jsr $df89


	lda #$02
	sta $fa
	lda #$80
	sta $fb

	lda $8000
	sta $fc
	lda $8001
	sta $fd

	;.byte 2

	ldy     #$01
	ldx     #$00
	lda     (sp),y
	tax

	bne loop2

	jmp loop4

loop2:
	ldy #$00
loop1:
	lda ($fa),y
	sta ($fc),y
	dey
	bne loop1
	inc $fb
	inc $fd
	dex
	cpx #$00
	bne loop2

loop4:
	ldy     #$00
	ldx     #$00
	lda     (sp),y
	tay

loop3:
	lda ($fa),y
	sta ($fc),y
	dey
	bne loop3

	lda ($fa),y
	sta ($fc),y

	lda #$00
	jsr $df86
	jsr $df89

	jsr popa;
	jsr popa;
	jsr popa;

	lda #$01
	rts
.endproc

